home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / host / RCS / Host_Start.c,v < prev    next >
Encoding:
Text File  |  1992-06-08  |  2.4 KB  |  121 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.2.1;
  5. locks    jhh:1.2; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     90.09.12.09.31.37;  author rab;  state Exp;
  11. branches 1.2.1.1;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     88.06.30.11.06.49;  author ouster;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19. 1.2.1.1
  20. date     92.06.07.20.35.51;  author kupfer;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @@
  27.  
  28.  
  29. 1.2
  30. log
  31. @replaced fseek(hostFile, 0, SET_SEEK) with rewind(hostFile).  SET_SEEK is not
  32. defined by sunOS, and rewind is clearer anyway.
  33. @
  34. text
  35. @/* 
  36.  * Host_Start.c --
  37.  *
  38.  *    Source code for the Host_Start library procedure.
  39.  *
  40.  * Copyright 1988 Regents of the University of California
  41.  * Permission to use, copy, modify, and distribute this
  42.  * software and its documentation for any purpose and without
  43.  * fee is hereby granted, provided that the above copyright
  44.  * notice appear in all copies.  The University of California
  45.  * makes no representations about the suitability of this
  46.  * software for any purpose.  It is provided "as is" without
  47.  * express or implied warranty.
  48.  */
  49.  
  50. #ifndef lint
  51. static char rcsid[] = "$Header: /sprite/src/lib/c/host/RCS/Host_Start.c,v 1.1 88/06/30 11:06:49 ouster Exp Locker: rab $ SPRITE (Berkeley)";
  52. #endif not lint
  53.  
  54. #include <stdio.h>
  55. #include <host.h>
  56.  
  57. /*
  58.  * Information about the current host database file:
  59.  */
  60.  
  61. FILE *        hostFile = (FILE *) NULL;
  62. char *        hostFileName = "/etc/spritehosts";
  63.  
  64. /*
  65.  *-----------------------------------------------------------------------
  66.  *
  67.  * Host_Start --
  68.  *
  69.  *    Begin reading from the the current host file.
  70.  *
  71.  * Results:
  72.  *    0 is returned if all went well.  Otherwise -1 is returned
  73.  *    and errno tells what went wrong.
  74.  *
  75.  * Side Effects:
  76.  *    If the file was open, it is reset to the beginning. If it was not
  77.  *    open, it is now.
  78.  *
  79.  *-----------------------------------------------------------------------
  80.  */
  81.  
  82. int
  83. Host_Start()
  84. {
  85.     if (hostFile != (FILE *) NULL) {
  86.     rewind(hostFile);
  87.     } else {
  88.     hostFile = fopen(hostFileName, "r");
  89.     if (hostFile == (FILE *) NULL) {
  90.         return -1;
  91.     }
  92.     }
  93.     return 0;
  94. }
  95. @
  96.  
  97.  
  98. 1.2.1.1
  99. log
  100. @Initial branch for Sprite server.
  101. @
  102. text
  103. @d17 1
  104. a17 1
  105. static char rcsid[] = "$Header: /sprite/src/lib/c/host/RCS/Host_Start.c,v 1.2 90/09/12 09:31:37 rab Exp Locker: jhh $ SPRITE (Berkeley)";
  106. @
  107.  
  108.  
  109. 1.1
  110. log
  111. @Initial revision
  112. @
  113. text
  114. @d17 1
  115. a17 1
  116. static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
  117. d52 1
  118. a52 1
  119.     fseek(hostFile, 0, SEEK_SET);
  120. @
  121.